// For future me, fixture like that are terrible, I know.
// We should have an other system for that, but I don't have time for that right now.
import { InvoiceTypeEnum } from '~/generated/graphql'

export const INVOICE_FIXTURE_ID = '1234'

export const fourOFourInvoiceMock = () => ({
  mock: {
    invoice: {
      id: INVOICE_FIXTURE_ID,
      refundableAmountCents: '0',
      creditableAmountCents: '0',
      paymentDisputeLostAt: null,
      invoiceType: InvoiceTypeEnum.Subscription,
      fees: [],
      invoiceSubscriptions: [],
      currency: 'EUR',
      number: 'HOO-AFA3-004-002',
      paymentStatus: 'pending',
      subTotalIncludingTaxesAmountCents: '0',
      couponsAmountCents: '0',
      feesAmountCents: '0',
      versionNumber: 3,
      __typename: 'Invoice',
    },
  },
})

export const fullSubscriptionInvoiceMockAndExpect = () => ({
  mock: {
    invoice: {
      id: INVOICE_FIXTURE_ID,
      refundableAmountCents: '0',
      creditableAmountCents: '2700000',
      invoiceType: InvoiceTypeEnum.Subscription,
      paymentDisputeLostAt: null,
      fees: [
        {
          id: 'fee-1-id',
          amountCurrency: 'EUR',
          itemCode: 'standard_plan',
          itemName: 'Standard Plan',
          invoiceName: 'Invoice custom name',
          invoiceDisplayName: 'Invoice custom name',
          creditableAmountCents: '100',
          appliedTaxes: [],
          trueUpFee: null,
          __typename: 'Fee',
        },
        {
          id: 'fee-2-id',
          amountCurrency: 'EUR',
          itemCode: 'sum_bm',
          itemName: 'Sum BM',
          invoiceName: 'Invoice custom name',
          invoiceDisplayName: 'Invoice custom name',
          creditableAmountCents: '2699900',
          appliedTaxes: [],
          trueUpFee: null,
          __typename: 'Fee',
        },
      ],
      invoiceSubscriptions: [
        {
          subscription: {
            id: 'invoice-subscription-subscription-1-id',
            name: null,
            plan: {
              id: 'invoice-subscription-subscription-1-plan-id',
              name: 'Standard Plan',
              invoiceDisplayName: 'Standard plan',
              __typename: 'Plan',
            },
            __typename: 'Subscription',
          },
          fees: [
            {
              id: 'invoice-subscription-fee-1-id',
              amountCurrency: 'EUR',
              feeType: 'subscription',
              appliedTaxes: [],
              invoiceName: 'Invoice custom name',
              invoiceDisplayName: 'Invoice custom name',
              creditableAmountCents: '100',
              trueUpFee: null,
              groupedBy: {},
              charge: null,
              chargeFilter: null,
              __typename: 'Fee',
            },
            {
              id: 'invoice-subscription-fee-2-id',
              amountCurrency: 'EUR',
              feeType: 'charge',
              appliedTaxes: [],
              invoiceName: 'Invoice custom name',
              invoiceDisplayName: 'Invoice custom name',
              creditableAmountCents: '2699900',
              trueUpFee: null,
              groupedBy: {},
              charge: {
                id: 'invoice-subscription-fee-2-charge-id',
                billableMetric: {
                  id: 'invoice-subscription-fee-2-charge-bm-id',
                  name: 'Sum BM',
                  __typename: 'BillableMetric',
                },
                __typename: 'Charge',
              },
              chargeFilter: null,
              __typename: 'Fee',
            },
          ],
          __typename: 'InvoiceSubscription',
        },
      ],
      currency: 'EUR',
      number: 'HOO-AFA3-004-002',
      paymentStatus: 'pending',
      subTotalIncludingTaxesAmountCents: '2700100',
      couponsAmountCents: '0',
      feesAmountCents: '2700100',
      versionNumber: 3,
      __typename: 'Invoice',
    },
  },
  transformedObject: {},
})

export const fullSubscriptionInvoiceGroupTrueUpMockAndExpect = () => ({
  mock: {
    invoice: {
      id: INVOICE_FIXTURE_ID,
      refundableAmountCents: '0',
      creditableAmountCents: '62833',
      invoiceType: InvoiceTypeEnum.Subscription,
      paymentDisputeLostAt: null,
      fees: [
        {
          id: 'b7e53061-73b5-46bf-8f1a-2f49d50c672c',
          amountCurrency: 'EUR',
          itemCode: 'group_true_up',
          itemName: 'group true up',
          creditableAmountCents: '167',
          invoiceName: 'Invoice custom name',
          invoiceDisplayName: 'Invoice custom name',
          appliedTaxes: [],
          trueUpFee: null,
          groupedBy: {},
          charge: null,
          chargeFilter: null,
          __typename: 'Fee',
        },
        {
          id: 'e94a7773-7641-4d81-a869-bb5c021c2817',
          amountCurrency: 'EUR',
          itemCode: 'count_bm_two_dimensions',
          itemName: 'Count BM - Two dimensions',
          creditableAmountCents: '3000',
          invoiceName: 'Invoice custom name',
          invoiceDisplayName: 'Invoice custom name',
          appliedTaxes: [],
          trueUpFee: {
            id: 'af3ca6df-02ba-4442-a455-c7eb6b0edc6b',
            __typename: 'Fee',
          },
          groupedBy: {},
          charge: null,
          chargeFilter: null,
          __typename: 'Fee',
        },
        {
          id: 'df9b74ff-b050-44a5-aad4-3ec87999f3c6',
          amountCurrency: 'EUR',
          itemCode: 'count_bm_two_dimensions',
          itemName: 'Count BM - Two dimensions',
          creditableAmountCents: '2000',
          invoiceName: 'Invoice custom name',
          invoiceDisplayName: 'Invoice custom name',
          appliedTaxes: [],
          trueUpFee: null,
          groupedBy: {},
          charge: null,
          chargeFilter: null,
          __typename: 'Fee',
        },
        {
          id: '0e1bd51c-07fe-445b-aade-28fdc88a488c',
          amountCurrency: 'EUR',
          itemCode: 'count_bm_two_dimensions',
          itemName: 'Count BM - Two dimensions',
          creditableAmountCents: '1000',
          invoiceName: 'Invoice custom name',
          invoiceDisplayName: 'Invoice custom name',
          appliedTaxes: [],
          trueUpFee: null,
          groupedBy: {},
          charge: null,
          chargeFilter: null,
          __typename: 'Fee',
        },
        {
          id: 'af3ca6df-02ba-4442-a455-c7eb6b0edc6b',
          amountCurrency: 'EUR',
          itemCode: 'count_bm_two_dimensions',
          itemName: 'Count BM - Two dimensions',
          creditableAmountCents: '10666',
          invoiceName: 'Invoice custom name',
          invoiceDisplayName: 'Invoice custom name',
          appliedTaxes: [],
          trueUpFee: null,
          groupedBy: {},
          charge: null,
          chargeFilter: null,
          __typename: 'Fee',
        },
        {
          id: '58b6e874-7d5f-4871-a9b3-7379dfbfd787',
          amountCurrency: 'EUR',
          itemCode: 'count_bm_one_dimension',
          itemName: 'Count BM - One dimension',
          creditableAmountCents: '3000',
          invoiceName: 'Invoice custom name',
          invoiceDisplayName: 'Invoice custom name',
          appliedTaxes: [],
          trueUpFee: null,
          groupedBy: {},
          charge: null,
          chargeFilter: null,
          __typename: 'Fee',
        },
        {
          id: '0769b8c4-38ed-4248-bda9-d62218c91b37',
          amountCurrency: 'EUR',
          itemCode: 'count_bm_one_dimension',
          itemName: 'Count BM - One dimension',
          creditableAmountCents: '3000',
          invoiceName: 'Invoice custom name',
          invoiceDisplayName: 'Invoice custom name',
          appliedTaxes: [],
          trueUpFee: null,
          groupedBy: {},
          charge: null,
          chargeFilter: null,
          __typename: 'Fee',
        },
        {
          id: '18892329-3951-4134-ac57-fe7233b1c723',
          amountCurrency: 'EUR',
          itemCode: 'sum_bm',
          itemName: 'Sum BM',
          creditableAmountCents: '40000',
          invoiceName: 'Invoice custom name',
          invoiceDisplayName: 'Invoice custom name',
          appliedTaxes: [],
          trueUpFee: null,
          groupedBy: {},
          charge: null,
          chargeFilter: null,
          __typename: 'Fee',
        },
        {
          id: '18892321-3951-4114-ac17-fe723311c723',
          amountCurrency: 'EUR',
          itemCode: 'sum_bm',
          itemName: 'Sum BM',
          creditableAmountCents: '0',
          invoiceName: 'Invoice custom name',
          invoiceDisplayName: 'Invoice custom name',
          appliedTaxes: [],
          trueUpFee: null,
          groupedBy: {},
          charge: null,
          chargeFilter: null,
          __typename: 'Fee',
        },
      ],
      invoiceSubscriptions: [
        {
          subscription: {
            id: 'b76a0e8c-26c5-4a04-9fe0-f928f0db1c5a',
            name: '',
            plan: {
              id: '3a16e062-7c1a-42b8-ba38-02fa11b1279d',
              name: 'group true up',
              invoiceDisplayName: 'Standard Plan',
              __typename: 'Plan',
            },
            __typename: 'Subscription',
          },
          fees: [
            {
              id: 'b7e53061-73b5-46bf-8f1a-2f49d50c672c',
              amountCurrency: 'EUR',
              feeType: 'subscription',
              appliedTaxes: [],
              creditableAmountCents: '167',
              invoiceName: 'Invoice custom name',
              invoiceDisplayName: 'Invoice custom name',
              trueUpFee: null,
              groupedBy: {},
              charge: null,
              chargeFilter: null,
              __typename: 'Fee',
            },
            {
              id: 'e94a7773-7641-4d81-a869-bb5c021c2817',
              amountCurrency: 'EUR',
              feeType: 'charge',
              appliedTaxes: [],
              creditableAmountCents: '3000',
              invoiceName: 'Invoice custom name',
              invoiceDisplayName: 'Invoice custom name',
              trueUpFee: {
                id: 'af3ca6df-02ba-4442-a455-c7eb6b0edc6b',
                __typename: 'Fee',
              },
              groupedBy: {},
              charge: {
                id: '5ff24500-2c67-4872-9808-746c59e94d38',
                billableMetric: {
                  id: '3e99dae9-46dc-4020-a676-3fc5020c22f9',
                  name: 'Count BM - Two dimensions',
                  __typename: 'BillableMetric',
                },
                __typename: 'Charge',
              },
              chargeFilter: {
                id: '5ff24500-2c67-4872-9808-746c59e94d38-f',
                invoiceDisplayName: null,
                values: {
                  provider: ['AWS'],
                  region: ['europe'],
                },
              },
              __typename: 'Fee',
            },
            {
              id: 'df9b74ff-b050-44a5-aad4-3ec87999f3c6',
              amountCurrency: 'EUR',
              feeType: 'charge',
              appliedTaxes: [],
              creditableAmountCents: '2000',
              invoiceName: 'Invoice custom name',
              invoiceDisplayName: 'Invoice custom name',
              trueUpFee: null,
              groupedBy: {},
              charge: {
                id: '5ff24500-2c67-4872-9808-746c59e94d38',
                billableMetric: {
                  id: '3e99dae9-46dc-4020-a676-3fc5020c22f9',
                  name: 'Count BM - Two dimensions',
                  __typename: 'BillableMetric',
                },
                __typename: 'Charge',
              },
              chargeFilter: {
                id: '5ff24500-2c67-4872-9808-746c59e94d38-f',
                invoiceDisplayName: null,
                values: {
                  provider: ['AWS'],
                  region: ['usa'],
                },
              },
              __typename: 'Fee',
            },
            {
              id: '0e1bd51c-07fe-445b-aade-28fdc88a488c',
              amountCurrency: 'EUR',
              feeType: 'charge',
              appliedTaxes: [],
              creditableAmountCents: '1000',
              invoiceName: null,
              invoiceDisplayName: null,
              trueUpFee: null,
              groupedBy: {},
              charge: {
                id: '5ff24500-2c67-4872-9808-746c59e94d38',
                billableMetric: {
                  id: '3e99dae9-46dc-4020-a676-3fc5020c22f9',
                  name: 'Count BM - Two dimensions',
                  __typename: 'BillableMetric',
                },
                __typename: 'Charge',
              },
              chargeFilter: {
                id: '5ff24500-2c67-4872-9808-746c59e94d38-f',
                invoiceDisplayName: null,
                values: {
                  provider: ['Google'],
                  region: ['usa'],
                },
              },
              __typename: 'Fee',
            },
            {
              id: 'af3ca6df-02ba-4442-a455-c7eb6b0edc6b',
              amountCurrency: 'EUR',
              feeType: 'charge',
              appliedTaxes: [],
              creditableAmountCents: '10666',
              invoiceName: null,
              invoiceDisplayName: null,
              trueUpFee: null,
              groupedBy: {},
              charge: {
                id: '5ff24500-2c67-4872-9808-746c59e94d38',
                billableMetric: {
                  id: '3e99dae9-46dc-4020-a676-3fc5020c22f9',
                  name: 'Count BM - Two dimensions',
                  __typename: 'BillableMetric',
                },
                __typename: 'Charge',
              },
              chargeFilter: null,
              __typename: 'Fee',
            },
            {
              id: '58b6e874-7d5f-4871-a9b3-7379dfbfd787',
              amountCurrency: 'EUR',
              feeType: 'charge',
              appliedTaxes: [],
              creditableAmountCents: '3000',
              invoiceName: null,
              invoiceDisplayName: null,
              trueUpFee: null,
              groupedBy: {},
              charge: {
                id: '594fe1d1-69f1-4b47-8cae-9c76fd409f76',
                billableMetric: {
                  id: '6576c6f2-947e-496c-ac5b-19b781ad0046',
                  name: 'Count BM - One dimension',
                  __typename: 'BillableMetric',
                },
                __typename: 'Charge',
              },
              chargeFilter: {
                id: '594fe1d1-69f1-4b47-8cae-9c76fd409f76-f',
                invoiceDisplayName: 'Invoice custom name for France value',
                values: {
                  region: ['france'],
                },
              },
              __typename: 'Fee',
            },
            {
              id: '0769b8c4-38ed-4248-bda9-d62218c91b37',
              amountCurrency: 'EUR',
              feeType: 'charge',
              appliedTaxes: [],
              creditableAmountCents: '3000',
              invoiceName: null,
              invoiceDisplayName: null,
              trueUpFee: null,
              groupedBy: {
                one: null,
                two: null,
              },
              charge: {
                id: '594fe1d1-69f1-4b47-8cae-9c76fd409f76',
                billableMetric: {
                  id: '6576c6f2-947e-496c-ac5b-19b781ad0046',
                  name: 'Count BM - One dimension',
                  __typename: 'BillableMetric',
                },
                __typename: 'Charge',
              },
              chargeFilter: {
                id: '594fe1d1-69f1-4b47-8cae-9c76fd409f76-f',
                invoiceDisplayName: null,
                values: {
                  region: ['italy'],
                },
              },
              __typename: 'Fee',
            },
            {
              id: '18892329-3951-4134-ac57-fe7233b1c723',
              amountCurrency: 'EUR',
              feeType: 'charge',
              appliedTaxes: [],
              creditableAmountCents: '40000',
              invoiceName: 'Invoice custom name',
              invoiceDisplayName: 'Invoice custom name',
              trueUpFee: null,
              groupedBy: {},
              charge: {
                id: '2030bb05-e627-40a5-b420-538fb6fbecab',
                billableMetric: {
                  id: '67774fc5-62e0-40c3-9502-ac7a2799e71d',
                  name: 'Sum BM',
                  __typename: 'BillableMetric',
                },
                __typename: 'Charge',
              },
              chargeFilter: null,
              __typename: 'Fee',
            },
            {
              id: '18892321-3951-4114-ac17-fe723311c723',
              amountCurrency: 'EUR',
              feeType: 'charge',
              appliedTaxes: [],
              creditableAmountCents: '0',
              invoiceName: 'Invoice custom name',
              invoiceDisplayName: 'Invoice custom name',
              trueUpFee: null,
              groupedBy: {},
              charge: {
                id: '2030bb05-e627-40a5-b420-538fb6fbecac',
                billableMetric: {
                  id: '67774fc5-62e0-40c3-9502-ac7a2799e71d',
                  name: 'Sum BM',
                  __typename: 'BillableMetric',
                },
                __typename: 'Charge',
              },
              chargeFilter: null,
              __typename: 'Fee',
            },
          ],
          __typename: 'InvoiceSubscription',
        },
      ],
      currency: 'EUR',
      number: 'HOO-AFA3-006-036',
      paymentStatus: 'pending',
      subTotalIncludingTaxesAmountCents: '62833',
      couponsAmountCents: '0',
      feesAmountCents: '62833',
      versionNumber: 3,
      __typename: 'Invoice',
    },
  },
  transformedObject: {
    'b76a0e8c-26c5-4a04-9fe0-f928f0db1c5a': {
      subscriptionName: 'Standard Plan',
      fees: {
        '0_b7e53061-73b5-46bf-8f1a-2f49d50c672c': {
          id: 'b7e53061-73b5-46bf-8f1a-2f49d50c672c',
          checked: true,
          value: 1.67,
          name: 'Invoice custom name',
          isTrueUpFee: false,
          trueUpFee: null,
          maxAmount: '167',
          appliedTaxes: [],
          succeededAt: undefined,
        },
        '5ff24500-2c67-4872-9808-746c59e94d38': {
          name: 'Invoice custom name',
          grouped: {
            'e94a7773-7641-4d81-a869-bb5c021c2817': {
              id: 'e94a7773-7641-4d81-a869-bb5c021c2817',
              checked: true,
              isTrueUpFee: false,
              value: 30,
              name: 'Invoice custom name',
              maxAmount: '3000',
              appliedTaxes: [],
            },
            'df9b74ff-b050-44a5-aad4-3ec87999f3c6': {
              id: 'df9b74ff-b050-44a5-aad4-3ec87999f3c6',
              checked: true,
              isTrueUpFee: false,
              value: 20,
              name: 'Invoice custom name',
              maxAmount: '2000',
              appliedTaxes: [],
            },
            '0e1bd51c-07fe-445b-aade-28fdc88a488c': {
              id: '0e1bd51c-07fe-445b-aade-28fdc88a488c',
              checked: true,
              isTrueUpFee: false,
              value: 10,
              name: 'Google • usa',
              maxAmount: '1000',
              appliedTaxes: [],
            },
          },
        },
        '2_af3ca6df-02ba-4442-a455-c7eb6b0edc6b': {
          id: 'af3ca6df-02ba-4442-a455-c7eb6b0edc6b',
          checked: true,
          value: 106.66,
          name: 'Standard Plan',
          isTrueUpFee: true,
          trueUpFee: null,
          maxAmount: '10666',
          appliedTaxes: [],
          succeededAt: undefined,
        },
        '594fe1d1-69f1-4b47-8cae-9c76fd409f76': {
          name: 'Count BM - One dimension',
          grouped: {
            '58b6e874-7d5f-4871-a9b3-7379dfbfd787': {
              id: '58b6e874-7d5f-4871-a9b3-7379dfbfd787',
              checked: true,
              isTrueUpFee: false,
              value: 30,
              name: 'Invoice custom name for France value',
              maxAmount: '3000',
              appliedTaxes: [],
            },
            '0769b8c4-38ed-4248-bda9-d62218c91b37': {
              id: '0769b8c4-38ed-4248-bda9-d62218c91b37',
              checked: true,
              isTrueUpFee: false,
              value: 30,
              name: 'italy',
              maxAmount: '3000',
              appliedTaxes: [],
            },
          },
        },
        '4_18892329-3951-4134-ac57-fe7233b1c723': {
          id: '18892329-3951-4134-ac57-fe7233b1c723',
          checked: true,
          value: 400,
          name: 'Invoice custom name',
          isTrueUpFee: false,
          trueUpFee: null,
          maxAmount: '40000',
          appliedTaxes: [],
          succeededAt: undefined,
        },
      },
    },
  },
})

export const fullOneOffInvoiceMockAndExpect = () => ({
  mock: {
    invoice: {
      id: INVOICE_FIXTURE_ID,
      refundableAmountCents: '0',
      creditableAmountCents: '2700000',
      invoiceType: InvoiceTypeEnum.OneOff,
      paymentDisputeLostAt: null,
      fees: [
        {
          id: 'fee-1-id',
          amountCurrency: 'EUR',
          itemCode: 'standard_plan',
          itemName: 'Standard Plan',
          creditableAmountCents: '100',
          invoiceName: 'Invoice custom name',
          invoiceDisplayName: 'Invoice custom name',
          appliedTaxes: [],
          trueUpFee: null,
          __typename: 'Fee',
        },
        {
          id: 'fee-2-id',
          amountCurrency: 'EUR',
          itemCode: 'sum_bm',
          itemName: 'Sum BM',
          creditableAmountCents: '0',
          invoiceName: 'Invoice custom name',
          invoiceDisplayName: 'Invoice custom name',
          appliedTaxes: [],
          trueUpFee: null,
          __typename: 'Fee',
        },
        {
          id: 'fee-3-id',
          amountCurrency: 'EUR',
          itemCode: 'sum_bm',
          itemName: 'Sum BM',
          creditableAmountCents: '2699900',
          invoiceName: 'Invoice custom name',
          invoiceDisplayName: 'Invoice custom name',
          appliedTaxes: [],
          trueUpFee: null,
          __typename: 'Fee',
        },
      ],
      invoiceSubscriptions: [],
      currency: 'EUR',
      number: 'HOO-AFA3-004-002',
      paymentStatus: 'pending',
      subTotalIncludingTaxesAmountCents: '2700100',
      couponsAmountCents: '0',
      feesAmountCents: '2700100',
      versionNumber: 3,
      __typename: 'Invoice',
    },
  },
  transformedObject: [
    {
      appliedTaxes: [],
      checked: true,
      id: 'fee-1-id',
      maxAmount: '100',
      name: 'Invoice custom name',
      value: 1,
    },
    {
      appliedTaxes: [],
      checked: true,
      id: 'fee-3-id',
      maxAmount: '2699900',
      name: 'Invoice custom name',
      value: 26999,
    },
  ],
})
